package main

import (
	"fmt"
	"os"
	"strconv"
	"sync"
	"time"
)

var (
	wg sync.WaitGroup
)

func delay(minute int) {
	defer wg.Done()
	time.Sleep(time.Duration(minute) * time.Minute)
}

func main() {
	var clock = 15
	if len(os.Args) > 1 {
		_clock, err := strconv.Atoi(os.Args[1])
		if err != nil {
			panic("输入分钟数")
		}
		clock = _clock
	}
	wg.Add(1)
	fmt.Println(strconv.Itoa(clock) + "分钟后提醒")
	go delay(int(clock))
	wg.Wait()
	fmt.Println(strconv.Itoa(clock) + "分钟，计时结束")

}
